﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;
using System.Web.Profile;
using System.Configuration;

namespace Medianamik.Core.Profile
{
    public class UserProfile : ProfileBase 
    {
        [SettingsAllowAnonymous(false)]
        public Guid NodeId
        {
            get
            {
                return (Guid)base["NodeId"];
            }
        }

        [SettingsAllowAnonymous(false)]
        public Guid User
        {
            get
            {
                return new Guid(base["User"].ToString());
            }
            set
            {
                base["User"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public string FullName
        {
            get
            {
                return (string)base["FullName"];
            }
            set
            {
                base["FullName"] = value;
            }
        }
        
        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public string UICultureName
        {
            get
            {
                return (string)base["UICultureName"];
            }
            set
            {
                base["UICultureName"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public DateTime LastLoginDate
        {
            get
            {
                return (base["LastLoginDate"] as DateTime?).GetValueOrDefault(DateTime.MinValue);
            }
            set
            {
                base["LastLoginDate"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider( ProviderName.ProfileProviderName  )]
        public DateTime? ExpirationDate
        {
            get
            {
                return (DateTime?)base["ExpirationDate"];
            }
            set
            {
                base["ExpirationDate"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public string Avatar
        {
            get
            {
                return (string)base["Avatar"];
            }
            set
            {
                base["Avatar"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public bool? Active
        {
            get
            {
                return (bool?)base["Active"];
            }
            set
            {
                base["Active"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public string WebSiteUrl
        {
            get
            {
                return (string)base["WebSiteUrl"];
            }
            set
            {
                base["WebSiteUrl"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public string Nickname
        {
            get
            {
                return (string)base["Nickname"];
            }
            set
            {
                base["Nickname"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public DateTime? SubscriptionDate
        {
            get
            {
                return (DateTime?)base["SubscriptionDate"];
            }
            set
            {
                base["SubscriptionDate"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public string Note
        {
            get
            {
                return (string)base["Note"];
            }
            set
            {
                base["Note"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public int EditorToolbarMode
        {
            get
            {
                return (base["EditorToolbarMode"] as int?).GetValueOrDefault(1);
            }
            set
            {
                base["EditorToolbarMode"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public bool EnableMultiLanguageFeatures
        {
            get
            {
                return (base["EnableMultiLanguageFeatures"] as bool?).GetValueOrDefault();
            }
            set
            {
                base["EnableMultiLanguageFeatures"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public bool MaySpecifyMedianamikLinkProtocol
        {
            get
            {
                return (base["MaySpecifyMedianamikLinkProtocol"] as bool?).GetValueOrDefault();
            }
            set
            {
                base["MaySpecifyMedianamikLinkProtocol"] = value;
            }
        }

        [SettingsAllowAnonymous(false)]
        [ProfileProvider(ProviderName.ProfileProviderName)]
        public bool MayManageOwnGroup
        {
            get
            {
                return (base["MayManageOwnGroup"] as bool?).GetValueOrDefault();
            }
            set
            {
                base["MayManageOwnGroup"] = value;
            }
        }
    }
}